home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 255_01 / gprdrow.asm < prev    next >
Encoding:
Assembly Source File  |  1988-03-28  |  3.4 KB  |  134 lines

  1.           page   80,132
  2.           page
  3. ;
  4. ;         Kent Cedola
  5. ;         2015 Meadow Lake Court
  6. ;         Norfolk, Virginia  23518
  7. ;
  8.  
  9. dgroup    group  _data
  10.  
  11. _data     segment word public 'data'
  12.           assume ds:dgroup
  13.  
  14.           extrn  _gdmerge:byte
  15.           extrn  _gdcur_x:word,_gdcur_y:word
  16.           extrn  _gdvw_x1:word,_gdvw_x2:word,_gdvw_x3:word
  17.           extrn  _gdvw_y1:word,_gdvw_y2:word,_gdvw_y3:word
  18.           extrn  _gdc_flg:byte
  19.  
  20. _data     ends
  21.  
  22. _text     segment byte public 'code'
  23.  
  24.           assume cs:_text,ds:dgroup
  25.           public _gprdrow
  26. _gprdrow  proc   near
  27.  
  28.           push   bp
  29.           mov    bp,sp
  30.           push   si
  31.           push   di
  32.  
  33.           mov    ax,_GDCUR_Y           ; Compute the segment of the graphic
  34.           shl    ax,1                  ;   byte that is to be changed
  35.           shl    ax,1                  ;   ES = A000 + (80 * Y) / 16;
  36.           add    ax,_GDCUR_Y           ;   ...
  37.           add    ax,0A000h             ;   ...
  38.           mov    es,ax                 ;   ...
  39.           mov    si,_GDCUR_X           ; Compute the column byte offset
  40.           mov    cx,si                 ;   ... (Save for later)
  41.           shr    si,1                  ;   SI = X / 8;
  42.           shr    si,1                  ;   ...
  43.           shr    si,1                  ;   ...
  44.           and    cl,7                  ;   ...  (It has to be done this way to
  45.  
  46.           mov    bx,[bp+6]
  47.           mov    di,[bp+4]
  48.           mov    bp,bx
  49.  
  50.           mov    dx,03CEh
  51.           mov    al,4
  52.           out    dx,al
  53.           inc    dx
  54.  
  55. ; four plane code
  56. ;         SI    = address of first byte
  57. ;         DX    = address of memory read port (all set up)
  58. ;         DI    = address of output array
  59. ;         BP    = width
  60. ;         CL    = bit rotate
  61. ;         ES    = graphic segment
  62.  
  63.           mov    al,0
  64.           out    dx,al
  65.           mov    ah,es:[si]
  66.           rol    ah,cl
  67.           mov    al,1
  68.           out    dx,al
  69.           mov    bh,es:[si]
  70.           rol    bh,cl
  71.           mov    al,2
  72.           out    dx,al
  73.           mov    bl,es:[si]
  74.           rol    bl,cl
  75.           mov    al,3
  76.           out    dx,al
  77.           mov    ch,es:[si]
  78.           rol    ch,cl
  79.  
  80.           sub    cl,8
  81.           neg    cl
  82.  
  83. nextbit4:
  84.           xor    al,al
  85.  
  86.           rol    ch,1
  87.           adc    al,0
  88.           rol    al,1
  89.           rol    bl,1
  90.           adc    al,0
  91.           rol    al,1
  92.           rol    bh,1
  93.           adc    al,0
  94.           rol    al,1
  95.           rol    ah,1
  96.           adc    al,0
  97.  
  98.           mov    [di],al
  99.           inc    di
  100.  
  101.           dec    bp
  102.           jz     rowend4
  103.  
  104.           dec    cl
  105.           jnz    nextbit4
  106.           inc    si
  107.           mov    al,0
  108.           out    dx,al
  109.           mov    ah,es:[si]
  110.           mov    al,1
  111.           out    dx,al
  112.           mov    bh,es:[si]
  113.           mov    al,2
  114.           out    dx,al
  115.           mov    bl,es:[si]
  116.           mov    al,3
  117.           out    dx,al
  118.           mov    ch,es:[si]
  119.  
  120.           mov    cl,8
  121.  
  122.           jmp    short nextbit4
  123.  
  124. rowend4:
  125.           pop    di
  126.           pop    si
  127.           pop    bp
  128.           ret                          ; Return to caller
  129.  
  130. _gprdrow  endp
  131.  
  132. _text     ends
  133.           end
  134.